<?php
$this->placeholder("navegacion")->set($this->navegacion($this->nav));
$domConfig = Zend_Registry::get("domConfig");

$perfil = App_Perfil::getInstance();
$perfil->cargar("ADMIN_AUTO2");//FIXME vcardenas ajustar el criterio
if ($perfil->crear()):
?>
<div align="right" class="buttons">
  <a class="btn btn-primary" href="<?php echo $this->baseUrl("/autoevaluacion/listasfactores/crear");?>">
  <span class="glyphicon glyphicon-plus-sign"></span> Crear lista de factores</a>
</div>
<?php
endif;

if(count($this->datos)>0): ?>
<table id="table_id" align="center" class="display">
  <thead>
    <tr>
      <th width="5%">No.</th>
      <th width="35%">Nombre</th>
      <th width="30%">Descripción</th>
      <th width="10%">Tipo</th>
      <th width="10%">Estado</th>
      <th width="10%">Acciones</th>
    </tr>
  </thead>
  <tbody>
	<?php foreach ($this->datos as $index => $value):?>
	<?php
		$params=App_Util_SafeUrl::encriptar(array("codlista"=>$value["codlista"]),true);
	?>
    <tr>
      <td style="text-align:center;"><?php echo $index+1;?></td>
      <td><?php echo $value["nombre"]; ?></td>
      <td><?php echo $value["descripcion"]; ?></td>
      <td style="text-align:center;"><?php echo $value["nombresubtipo"];?></td>
      <td style="text-align:center;"><?php echo $domConfig->ESTADO_STR->get($value["activo"]);?></td>
      <td>
        <?php
        $tools = new App_Util_ToolButton();
        $tools->addEdit($this->baseUrl("/autoevaluacion/listasfactores/modificar/{$params}"),$perfil->modificar());
        $tools->add($this->baseUrl("/autoevaluacion/listasfactores/ingresarsecciones/{$params}"), "Ingresar secciones", "glyphicon glyphicon-cog", $perfil->modificar());
        echo $tools->render();
   		?>
      </td>
    </tr>
  <?php  endforeach;?>
  </tbody>
</table>

<script type="text/javascript">
$(function() {
	var oTable = $('#table_id').dataTable({
		"bJQueryUI": true,
		"bAutoWidth": false,
 		"sPaginationType": "full_numbers",
 		"bStateSave": true,
 		"aoColumns": [
 	 		 			null,
 	 		 			null,
 	 		 			null,
 	 		 			null,
 	 		 			null,
 	 		 			{ "bSortable": false, "bSearchable": false }
 	 		 		 ]
 	 		  		
	});
	
	oTable.fnSetFilteringDelay();
	//oTable.fnCreateFilters([4]);
	//oTable.fnAssignFilterValues(2, [jsdrse])

});
</script>
<?php else:?>
<br/>
<?php echo $this->mensajes("No existen registros");?>
<?php endif;?>
